﻿<div class="list-block" style="margin: 0;" ms-controller="MCCXJ">
    <ul>
        <!-- Text inputs -->
        <li>
            <div class="item-content">
                <div class="item-inner">
                    <div class="item-title label">接收号码</div>
                    <div class="item-input">
                        <div style=" line-height: 1.4; padding-top: .6rem;padding-bottom:.6rem; padding-left:.6rem">{{modelData.ShenQingRen}}</div>
                    </div>
                </div>
            </div>
        </li>
        <li>
            <div class="item-content" ms-class-1="item-link:temptype=='edit'">
                <div class="item-inner">
                    <div class="item-title label">申请类型</div>
                    <div class="item-input">
                        <select name="conType" id="conType" ms-duplex="modelData.LeiBie" ms-attr-disabled="temptype=='view'?'disabled':''">
                            <option ms-repeat-item="ColumnData" ms-attr-value="item.ID" ms-attr-selected="item.ID==modelData.LeiBie?'selected':''">{{item.TypeName}}</option>
                        </select>
                    </div>
                </div>
            </div>
        </li>
        <li>
            <div class="item-content" ms-class-1="item-link:temptype=='edit'">
                <div class="item-inner">
                    <div class="item-title label">开始时间</div>
                    <div class="item-input">
                        <input ms-if="temptype=='edit'" type="text" placeholder="请选择开始时间" id="StarTime" ms-duplex="modelData.StarTime" class="szhl szhl_require" />
                        <div ms-if="temptype=='view'">{{modelData.StarTime}}</div>
                    </div>
                </div>
            </div>
        </li>
        <li>
            <div class="item-content" ms-class-1="item-link:temptype=='edit'">
                <div class="item-inner">
                    <div class="item-title label">结束时间</div>
                    <div class="item-input">
                        <input ms-if="temptype=='edit'" type="text" placeholder="请选择结束时间" id="EndTime" ms-duplex="modelData.EndTime" class="szhl szhl_require" />
                        <div ms-if="temptype=='view'">{{modelData.EndTime}}</div>
                    </div>
                </div>
            </div>
        </li>
        <li>
            <div class="item-content">
                <div class="item-inner">
                    <div class="item-title label">请假天数</div>
                    <div class="item-input">
                        <input ms-if="temptype=='edit'" type="tel" ms-duplex="modelData.Daycount" class="szhl szhl_require" min="1" placeholder="请选择请假天数" />
                        <div ms-if="temptype=='view'">{{modelData.Daycount}}</div>
                    </div>
                </div>
            </div>
        </li>
        <!-- Date -->
        <li>
            <div class="item-content">
                <div class="item-inner">
                    <div class="item-title label">请假事由</div>
                    <div class="item-input">
                        <textarea ms-if="temptype=='edit'" type="text" ms-duplex="modelData.ZhuYaoShiYou" rows="2" class="szhl szhl_require" placeholder="请选择请假事由"></textarea>
                        <div ms-if="temptype=='view'" style="overflow: hidden; word-wrap: break-word; word-break: break-all; ">{{modelData.ZhuYaoShiYou|html}}</div>
                    </div>
                </div>
            </div>
        </li>
        <li class="align-top">
            <div class="item-content">
                <div class="item-inner">
                    <div class="item-title label">图片</div>
                    <div class="item-input">
                        <input ms-if="temptype=='edit'" type="text" ms-duplex="modelData.Files" class="wximgupload" style="display:none;" />
                        <div ms-if="temptype=='view'" class="viewimg">{{modelData.Files}}</div>
                    </div>
                </div>
            </div>
        </li>
    </ul>
</div>
<script>
    var tempmodel = avalon.define({
        $id: "MCCXJ",
        ColumnData: [],
        tpData: [],
        temptype: "edit", //edit,view
        name: "出差休假",
        iswf: true,//是否属于流程表单
        inittemp: function (strId) {

            $.getJSON('/API/VIEWAPI.ashx?Action=XTGL_GETZIDIANLIST', { P1: 1 }, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    tempmodel.ColumnData = resultData.Result;
                    if (!tempmodel.modelData.LeiBie) {
                        tempmodel.modelData.LeiBie = resultData.Result[0].ID
                    };
                }
            })
            tempmodel.modelData.ShenQingRen = ComFunJS.convertuser(ComFunJS.getnowuser());
            if (strId) {
                //编辑加载数据
                tempmodel.temptype = pmodel.pageType;
                $.getJSON('/API/VIEWAPI.ashx?Action=CCXJ_GETCCXJMODEL', { P1: strId }, function (resultData) {

                    if (resultData.ErrorMsg == "") {
                        tempmodel.modelData = resultData.Result;
                        tempmodel.tpData = resultData.Result2;
                        ComFunJS.uploadimgnew(tempmodel.tpData);
                        ComFunJS.viewimg(tempmodel.tpData);
                        if (tempmodel.modelData.StarTime && tempmodel.modelData.StarTime.length > 10) {
                            tempmodel.modelData.StarTime = tempmodel.modelData.StarTime.substring(0, 10);

                            $("#StarTime").calendar({
                                value: [tempmodel.modelData.StarTime]
                            });
                        }
                        if (tempmodel.modelData.EndTime && tempmodel.modelData.EndTime.length > 10) {
                            tempmodel.modelData.EndTime = tempmodel.modelData.EndTime.substring(0, 10);

                            $("#EndTime").calendar({
                                value: [tempmodel.modelData.EndTime]
                            });
                        }
                        setTimeout("ComFunJS.initForm()", 500)

                    }
                })
            } else {
                $("#StarTime").calendar({
                    value: [ComFunJS.getnowdate("yyyy-mm-dd")]
                });
                $("#EndTime").calendar({
                    value: [ComFunJS.getnowdate("yyyy-mm-dd")]
                });
                ComFunJS.uploadimgnew();
                ComFunJS.initForm();
                $(".btnSucc").text("送审");
            }
        },//初始化
        modelData: { "ShenQingRen": "", "StarTime": "", "EndTime": "", "Daycount": "1", "LeiBie": "", "SPUser": "", "ChaoSongRen": "", "ZhuYaoShiYou": "", "Files": "" },
        SaveData: function (callback) {
            $.post("/API/VIEWAPI.ashx?ACTION=CCXJ_ADDCCXJ", { P1: JSON.stringify(tempmodel.modelData.$model) }, function (result) {
                return callback.call(this, $.parseJSON(result));
            });
        },
        Complate: function () {
            window.location.href = "/View_Mobile/UI/UI_DXGL_LIST.html?r=" + Math.random();
        }
    });//@ sourceURL=MCCXJ.js;

</script>